package collectionUnSafe.set;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArraySet;

public class SetTestSafe2 {
    public static void main(String[] args) {
        Set<Object> set = new CopyOnWriteArraySet<>();

        for(int i = 0 ; i < 10 ; i++){
            new Thread(()->{
                set.add(UUID.randomUUID().toString().substring(0,5));
                System.out.println(set);
            },String.valueOf(i)).start();
        }
    }
}
